#include <iostream>
using namespace std;

int main()
{
	int a, b, c, d;
	int sum_time, hour, minute;
	cin >> a >> b >> c >> d;
	sum_time = (c * 60 + d) - (a * 60 + b);
	hour = sum_time / 60;
	minute = sum_time % 60;
	cout << hour << " " << minute << endl;
	return 0;
}
